//
//  YKClientDataItemCell.m
//  YunKang
//
//  Created by leoking870 on 2017/9/26.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKClientDataItemCell.h"
#import "YKDashView.h"



@interface YKClientDataItemCell()
@property (weak, nonatomic) IBOutlet UILabel *companyNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *clientTypeLabel;
@property (weak, nonatomic) IBOutlet UILabel *moneyTypeLabel;
@property (weak, nonatomic) IBOutlet UILabel *orderNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *cashNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;

@end


@implementation YKClientDataItemCell
@dynamic tableViewItem;
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)cellLoadSubViews {
    [super cellLoadSubViews];

    YKDashView* dashView = [[YKDashView alloc]init];
    dashView.lineWidth = .5f;
    dashView.lineColor = [UIColor tf_colorWithHexString:@"#d4d4d4"];
    dashView.dashLineLength = 3;
    [self addSubview:dashView];
    [dashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

- (void)cellWillAppear {
    [super cellWillAppear];
    
    self.companyNameLabel.text = self.tableViewItem.model.C_NAME;
    self.clientTypeLabel.text = self.tableViewItem.model.CT_NAME;
    self.moneyTypeLabel.text = self.tableViewItem.model.ST_NAME;
    self.orderNumberLabel.text =
    [NSString stringWithFormat:@"累积订单:%.1f", self.tableViewItem.model.RECEIVABLE_AMOUNT];
    self.cashNumberLabel.text = [NSString stringWithFormat:@"累积收款:%.1f", self.tableViewItem.model.ACCOUNT_PAYMENT];
    self.numberLabel.text = [NSString stringWithFormat:@"积分:%@",self.tableViewItem.model.ENTERP_POINTS];
    
    [self.contentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        if ([obj isKindOfClass:[UILabel class]]) {
            UILabel *label = (UILabel *)obj;
            label.textColor = [UIColor blackColor];
        }
    }];
}

@end
